# -*- coding: utf-8 -*-
"""
# @Time    : 2021/1/13 下午4:00
# @Author  : tgy

    鸭子类型： 对应的方法即可，不强制继承某个父类。
"""
import sys
import os

day11_path = os.path.dirname(os.path.dirname(__file__)) + os.path.sep + 'day11'

if os.path.exists(day11_path):
    sys.path.append(day11_path)
    from property import Person



class Car:
    def run(self):
        ...
        print('car run')


class ToyotaCar:
    def run(self):
        print('Toyota car')


class HondaCar:
    def run(self):
        print('Honda car')


def run(car):
    ...
    if hasattr(car,'run'):
        getattr(car,'run')()
    else:
        raise NameError('%s not run method' % car)

if __name__ == '__main__':
    ...
    run(Car())
    run(ToyotaCar())
    run(HondaCar())
    person = Person('zhangsan', 21)
    run(person)
